import openai
#这是一个非常简单的调运openai api去聊天的源码 需要tizi配合使用，具体内容可自己修改
openai.api_key = "api"
messages = []

while True:
    # Collect the user's message
    print("\n")
    message = input("人类说：")
    messages.append({"role":"user","content": message})

    response=openai.ChatCompletion.create(
    model="gpt-3.5-turbo",
    messages=messages
    )

    reply = response["choices"][0]["message"]["content"]
    print("ChatGPT说: ", reply)

    # Check if the user wants to exit the conversation